package com.dragon.loan.service;

import com.dragon.common.service.BaseService;
import com.dragon.loan.entity.AcLoanApplyBxInfo;
import com.dragon.loan.repository.AcLoanApplyBxInfoRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class AcLoanApplyBxInfoServiceImpl extends BaseService<AcLoanApplyBxInfo, Long> implements AcLoanApplyBxInfoService{
	
	@Autowired
	private AcLoanApplyBxInfoRepository acLoanApplyBxInfoRepository;
	
	/**
	 * 批量保存保单信息
	 * wanggang
	 * @param loanId
	 * @param acLoanApplyBxInfos
	 */
	public void save(String loanId,List<AcLoanApplyBxInfo> acLoanApplyBxInfos) {
		for (AcLoanApplyBxInfo acLoanApplyBxInfo : acLoanApplyBxInfos) {
			acLoanApplyBxInfo.setLoanId(loanId);
			acLoanApplyBxInfo.setCreateTime(new Date());
			acLoanApplyBxInfo.setUpdateTime(new Date());
			save(acLoanApplyBxInfo);
		}
	}
	
	
	/**
	 * 查询保单信息
	 * @param loanId
	 * @return
	 */
	public List<AcLoanApplyBxInfo> querybxInfo(String loanId){
		return acLoanApplyBxInfoRepository.querybxInfo(loanId);
	}
}
